<app:page xmlns:h="http://java.sun.com/jsf/html"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:app="http://java.sun.com/jsf/composite/app"
          xmlns:ds="http://deltaset.org/deltaset-faces"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:c="http://java.sun.com/jsp/jstl/core"
          pageTitle="#{requestRideMsg['view.title']}">    

    <ds:titlebar title="#{requestRideMsg['view.title']}">
        <h:button outcome="/secured/requestRide/form" 
                  value="#{deltasetMessages['deltaset.crud.add']}"
                  styleClass="ds-button"/>
        <h:button outcome="/secured/requestRide/list" 
                  value="#{deltasetMessages['deltaset.crud.list']}"
                  styleClass="ds-button"/>
    </ds:titlebar>
    <c:set target="#{viewScope}" property="requestRideModel" value="#{requestRideBean.loadModel(param.requestRideId)}"/>
    
    <h:form>
        <ds:fieldset>
            <h:messages styleClass="ui-state-highlight ui-corner-all"/>
                          
            <h:outputLabel for="rideState" value="#{requestRideMsg['rideState']}" styleClass="ds-label"/>
            <h:selectOneListbox id="rideState" value="#{viewScope.requestRideModel.rideState}"  styleClass="ui-widget-content ui-corner-all ds-field" size="1">
                <f:selectItems  value="#{requestRideBean.rideStateValues}" var="op"
                                itemValue="#{op}" itemLabel="#{op.label}"/>
            </h:selectOneListbox>                          
            <ds:inputDate label="#{requestRideMsg['startTime']}"
                          value="#{viewScope.requestRideModel.startTime}"
                          requiredMessage="#{deltasetMessages['deltaset.crud.required']}"
                          required="true"/>                       
        </ds:fieldset>


        <ui:include src="/secured/address/many-to-one.xhtml">
            <ui:param name="addressModel" value="#{viewScope.requestRideModel.startAddress}"/>
            <ui:param name="addressTarget" value="viewScope.requestRideModel.startAddress"/>
        </ui:include>
        <ui:include src="/secured/address/many-to-one.xhtml">
            <ui:param name="addressModel" value="#{viewScope.requestRideModel.endAddress}"/>
            <ui:param name="addressTarget" value="viewScope.requestRideModel.endAddress"/>
        </ui:include>         
        
        <div class="ds-margin-top">
            <h:commandButton action="#{requestRideBean.save(viewScope.requestRideModel)}"
                             value="#{deltasetMessages['deltaset.crud.save']}"
                             styleClass="ds-button">               
            </h:commandButton>
            <h:commandButton value="#{deltasetMessages['deltaset.crud.delete']}"
                             action="#{requestRideBean.delete(viewScope.requestRideModel)}"
                             onclick="return deltaset.confirm(this)"
                             disabled="#{requestRideBean.isNew(viewScope.requestRideModel)}"
                             styleClass="ds-button">               
            </h:commandButton>
        </div>
    </h:form>
</app:page>